package com.fpt.group3.service;

import java.util.LinkedList;

import com.fpt.group3.dao.TrustRegionDAOImpl;
import com.fpt.group3.form.TrustRegion;
import com.fpt.group3.service.exception.SystemException;

/**
 * TrustRegionServiceImpl.
 * @author John Tran
 */
public class TrustRegionServiceImpl implements TrustRegionService {

    /**
     * trustRegionImplDAO field.
     */
    private TrustRegionDAOImpl trustRegionImplDAO;

    /**
     * setTrustRegionImplDAO.
     * @param trustRegionImplDAOIn trustRegionImplDAO
     */
    public final void setTrustRegionImplDAO(
            final TrustRegionDAOImpl trustRegionImplDAOIn) {
        this.trustRegionImplDAO = trustRegionImplDAOIn;
    }

    /**
     * addTrustRegion.
     * @param tr Trust Region In
     * @return boolean
     * @exception SystemException throw ex
     */
    @Override
    public final boolean addTrustRegion(final TrustRegion tr)
            throws SystemException {
        return trustRegionImplDAO.addTrustRegion(tr);
    }

    /**
     * amendTrustRegion.
     * @param tr Trust Region In
     * @return boolean
     * @exception SystemException throw ex
     */
    @Override
    public final boolean amendTrustRegion(final TrustRegion tr)
            throws SystemException {
        return trustRegionImplDAO.amendTrustRegion(tr);
    }

    /**
     * listTrustRegion.
     * @param isActive trust region status
     * @return list trust region
     * @exception SystemException throw ex
     */
    @Override
    public final LinkedList<TrustRegion> listTrustRegion(final boolean isActive)
            throws SystemException {
        return trustRegionImplDAO.listTrustRegion(isActive);
    }

    /**
     * getRegionIdByName.
     * @param reName trust region name
     * @return int
     * @exception SystemException throw ex
     */
    @Override
    public final int getRegionIdByName(final String reName)
            throws SystemException {
        return trustRegionImplDAO.getRegionIdByName(reName);
    }

    /**
     * changTrustRegionStatus.
     * @param trID trust region ID
     * @param active trust region status
     * @return boolean
     * @exception SystemException throw ex
     */
    @Override
    public final boolean changTrustRegionStatus(final int trID,
            final int active) throws SystemException {
        return trustRegionImplDAO.changTrustRegionStatus(trID, active);
    }
}
